<?php
require(dirname(__FILE__)."/config.php");
CheckPurview('plus_幻灯片管理');
require_once DEDEINC."/typelink.class.php";
require_once(DEDEINC."/customfields.func.php");
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
if(empty($dopost)) $dopost = '';

$id = (isset($id) && is_numeric($id)) ? $id : 0;
if($id==0) die(" Request Error! ");
$ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? "flash_main.php" : $_COOKIE['ENV_GOBACK_URL'];

if($dopost=='delete')
{
	$dsql->ExecuteNoneQuery("Delete From `#@__flash` where id='$id' ");
	ShowMsg("成功删除一个幻灯片！",$ENV_GOBACK_URL);
	exit();
}
else if($dopost=='edit')
{
	//处理远程图片
    if(empty($ddisremote))
    {
        $ddisremote = 0;
    }
    $litpic = GetDDImage('none', $litpic, $ddisremote);
	if(empty($ddisremote2))
    {
        $ddisremote2 = 0;
    }
    $litimg = GetDDImage('none', $litimg, $ddisremote2);
	$query = "Update `#@__flash`
	 set
	 sortrank='$sortrank',
	 title='$title',
	 typeid='$typeid',
	 litpic='$litpic',
	 litimg='$litimg',
	 content='$content',
	 arcurl='$arcurl'
	 where id='$id'
	 ";
	$dsql->ExecuteNoneQuery($query);
	ShowMsg("成功更改幻灯片！",$ENV_GOBACK_URL);
	exit();
}

$row = $dsql->GetOne("Select * From `#@__flash` where id='$id'");
$dsql->Execute('dd','SELECT * FROM `#@__flashtype` ORDER BY id DESC');
$option = '';
while($arr = $dsql->GetArray('dd'))
{
    if ($arr['id'] == $row['typeid'])
    {
        $option .= "<option value='{$arr['id']}' selected='selected'>{$arr['typename']}</option>\n\r";
    } else {
        $option .= "<option value='{$arr['id']}'>{$arr['typename']}</option>\n\r";
    }
}
include DedeInclude('templets/flash_edit.htm');

?>